package cn.zkld.web;
import cn.zkld.model.GoodsInfo;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


/**
 * Created by 李景辉 on 2017/12/19.
 */
@Controller
public class LoginController extends Base {
    @RequestMapping("/login")
    public String login()throws Exception{
        String exceptionClassname=request.getParameter("shiroLoginFailure");
        if(exceptionClassname!=null){
            if (UnknownAccountException.class.getName().equals(exceptionClassname)){
                throw new Exception("账号不存在");
            }else if (IncorrectCredentialsException.class.getName().equals(exceptionClassname)){
                throw new Exception("对不起，用户名/密码错误");
            }else{
              throw new Exception();
            }
        }
        //此方法不处理登陆成功
        return "login";
    }
}
